package com.jumeng.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.jumeng.entity.CourseEntity;
import com.jumeng.query.CoursesQuery;
import com.jumeng.resp.CoursesRes;
import com.jumeng.server.CourseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController("/api/course")
@Api(tags = "课程接口")
public class CourseController {


    @Autowired
    private CourseService courseService;


    @PostMapping("/page")
    @ApiOperation("课程列表页面")
    public Page<CoursesRes> page(@RequestBody CoursesQuery coursesQuery) {
        return courseService.page(coursesQuery);
    }

    @GetMapping("/details/{accountStationNo}/{courseCode}")
    @ApiOperation("课程详情")
    public CoursesRes details(@PathVariable("accountStationNo") String accountStationNo, @PathVariable("courseCode") String courseCode) {
        return courseService.details(accountStationNo, courseCode);
    }

}
